package com.itheima.controller;

import com.itheima.service.UserService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {

//    注入service
//    @Autowired//本地注入
    /*
    * 1.从注册中心获取userservice的访问url
    * 进行远程调用RPC对象.给变量赋值
    * 将结果封装为一个代理
    * */
    @Reference//远程注入
    private UserService userService;

    @RequestMapping("/sayHello")
    public String seyHello(){
        return userService.sayHello();
    }
}
